home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3752 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.2 KB

  1. Path: csd.uwo.ca!jamie
  2. From: jamie@csd.uwo.ca (J. Blustein)
  3. Newsgroups: comp.edu,comp.lang.c,comp.lang.c++
  4. Subject: Re: C or C++ for a 14-year old? The definitive reply
  5. Date: 25 Jan 1996 22:30:03 GMT
  6. Organization: Computer Science Dept., Univ. of Western Ontario, London, Canada
  7. Message-ID: <4e909b$k8@falcon.ccs.uwo.ca>
  8. References: <4cve3a$f0n@news.iconn.net> <4danli$llb@news.onramp.net> <4e3mvdINNpi3@mayne.ugrad.cs.ubc.ca> <4e5t1c$71c@solutions.solon.com>
  9. Reply-To: jamie@uwo.ca
  10. NNTP-Posting-Host: gleep.csd.uwo.ca
  11. Summary: There is no inefficiency in hinding data/code with C.  Example below.
  12. Keywords: opaque type abstract data ADT
  13. X-Copyright: copyright (c) J. Blustein, 1996.  All rights reserved 
  14. X-Url: http://www.csd.uwo.ca/~jamie/.Refs/encapsulatedC.html 
  15. Disclaimer: It's people like you what cause unrest!
  16.  
  17. In article <4e5t1c$71c@solutions.solon.com>,
  18. Peter Seebach <seebs@solutions.solon.com> wrote:
  19. >In article <4e3mvdINNpi3@mayne.ugrad.cs.ubc.ca>,
  20. >Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
  21. >>Information hiding leads to inefficiencies---and you _can_ have it in C, by the
  22. >>way. Even the C preprocessor lets you have efficient information hiding, if you
  23. >>use it with discipline. It's cheaper to access elements of a function via
  24. >>macros than be forced to communicate via abstract function calls. The only
  25. >>advantage that information hiding gives you is that 1) you can change the
  26. >>implementation of the data structure easily without recompiling modules that
  27. >>use it (big deal). 2) you have more control over how your software gets used. I
  28.     You don't have to resort to using the pre-processor to hide types and
  29. function calls.  If you use opaque types there is no runtime penalty and
  30. you get plenty of hiding.  Think about how FILE * is hidden in the standard
  31. library for example.
  32.     I scribbled some notes about this at
  33. http://www.csd.uwo.ca/~jamie/.Refs/encapsulatedC.html 
  34. .  Feel free to take a look.
  35.  
  36. [...]
  37. >Point 1 is, in fact, a *very* big deal.  The larger the project, the more
  38.     I agree of course.
  39. -- 
  40. Jamie Blustein                                         `Did you say "knives"?'
  41. <jamie@uwo.ca>                                         `*Rotating* knives, yes.'
  42.